package com.jic.order.controller.feign;

import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.jic.common.base.vo.RestResult;
import com.jic.order.api.OrderStatisticsApi;
import com.jic.order.request.OrderStatisticsRequest;
import com.jic.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 名    称：OrderStatisticsController
 * 功    能：
 * 创 建 人：K.K
 * 创建时间：2020/11/29 16:48
 * 修 改 人：
 * 修改时间：
 * 说    明：
 * 版 本 号：
 */
@RestController
@RequestMapping(value = "/api/order/statistics")
@Api(tags = {"订单统计接口"})
@Slf4j
public class OrderStatisticsController implements OrderStatisticsApi {

    @Autowired
    private OrderService orderService;

    @Override
    @ApiOperation(value = "统计首次支付订单的用户数接口")
    @ResponseBody
    @RequestMapping(value = "/queryFirstPaymentCount")
    public RestResult<Map<String, Long>> queryFirstPaymentCount(OrderStatisticsRequest request) {
        return orderService.queryFirstPaymentCount(request);
    }

    @Override
    @ApiOperation(value = "统计订单用户接口")
    @ResponseBody
    @RequestMapping(value = "/queryOrderCount")
    public RestResult<Map<String, Long>> queryOrderCount(OrderStatisticsRequest request) {
        return orderService.queryOrderCount(request);
    }

    @Override
    public RestResult<Map<String, Map<String,Object>>> queryOrderGmv(OrderStatisticsRequest request) {
        return orderService.queryOrderGmv(request);
    }

    @Override
    public RestResult<List<JSONObject>> querySubmitOrderUserLeft(OrderStatisticsRequest request) {
        return orderService.querySubmitOrderUserLeft(request);
    }


}
